package com.example.drcbackend.controller;

import com.example.drcbackend.jwt.Result;
import com.example.drcbackend.service.FileUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/upload")
@CrossOrigin
public class FileUploadController {

    @Autowired
    private FileUploadService fileUploadService;

    @PostMapping("/sql")
    public Object uploadSQLFile(@RequestParam("file") MultipartFile file) {


        return fileUploadService.uploadSQLFile(file);
    }

    @PostMapping("/setsql")
    public Object setuploadSQLFile(@RequestParam("file") MultipartFile file,int DBid) {


        return fileUploadService.setuploadSQLFile(file,DBid);
    }
}
